package com.sky.mapper;

import com.sky.annotation.aop.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {
    @AutoFill(OperationType.INSERT)
    void add(Dish dish);

    List<DishVO> selectPage(DishPageQueryDTO pageQueryDTO);

    Dish selectById(@Param("id") Long id);

    void deleteBatches(List<Long> ids);

    @AutoFill(OperationType.UPDATE)
    void update(Dish dish);

    List<Dish> selectByCategoryId(@Param("categoryId") Long categoryId);

    List<DishVO> selectDishesByCategoryId(Dish dish);
    /**
     * 根据条件统计菜品数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
